package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.SignBean;
import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.contract.UserSignContract;
import com.xuxin.baby.model.UserSignModel;

/**
 * Created by xu_xin
 * Created on 2020/10/23 0023
 * 签到
 */
public class UserSignPresenter implements UserSignContract.Presenter {
    private  final UserSignModel model;
    private  final UserSignContract.View view;

    public UserSignPresenter(UserSignContract.View view) {
        this.view = view;
        model = new UserSignModel();
    }

    @Override
    public void getUserSign(String tenantId, String token, String memberId, int skipCount) {
        if (null != model) {
            model.getUserSign(this, tenantId, token, memberId, skipCount);
        }
    }

    @Override
    public void sign(String tenantId, String token, String memberId, String date) {
        if (null != model) {
            model.sign(this, tenantId, token, memberId, date);
        }
    }

    @Override
    public void onSuccess(SignBean signBean) {
        if (null != view) {
            view.onSuccess(signBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}